package com.csthink.mr.join.reducejoin;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;

/**
 * @author <a href="mailto:csthink@icloud.com">Mars</a>
 * @since 2024-04-16 15:10
 */
public class EmpInfo implements Writable, Serializable {

    private String empId;
    private String empName;
    private Integer deptNo;
    private String deptName;
    /**
     * 标记数据来自哪个表
     */
    private Integer flag;

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeUTF(empId);
        out.writeUTF(empName);
        out.writeInt(deptNo);
        out.writeUTF(deptName);
        out.writeInt(flag);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        this.empId = in.readUTF();
        this.empName = in.readUTF();
        this.deptNo = in.readInt();
        this.deptName = in.readUTF();
        this.flag = in.readInt();
    }

    @Override
    public String toString() {
        return empId + '\t' + empName + '\t' + deptNo + "\t" + deptName;
    }

    public String getEmpId() {
        return empId;
    }

    public void setEmpId(String empId) {
        this.empId = empId;
    }

    public String getEmpName() {
        return empName;
    }

    public void setEmpName(String empName) {
        this.empName = empName;
    }

    public Integer getDeptNo() {
        return deptNo;
    }

    public void setDeptNo(Integer deptNo) {
        this.deptNo = deptNo;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public Integer getFlag() {
        return flag;
    }

    public void setFlag(Integer flag) {
        this.flag = flag;
    }
}
